<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        div {
            width: 300px;
            height: 200px;
            background: skyblue;
            margin: 50px auto;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        let div = document.querySelector('div');
        console.dir(div);
        let time = new Date();
        // console.log(time.getTime());
        div.innerHTML = time;
        let year = time.getFullYear();
        let month = time.getMonth() + 1;
        let date = time.getDate();
        let day = time.getDay();
        let week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
        console.log(year);
        console.log(month);
        console.log(date);
        console.log(day);
        console.log(week[day]);
        var t='今天是' + year + '年' + month + '月' + date + '日' + week[day];
        div.innerHTML = t;
        

    </script>
</body>

</html>